package com.example.literj.kt.internal.operators.observable

import com.example.literj.kt.core.Observable
import com.example.literj.kt.core.Observer
import com.example.literj.kt.internal.operators.ScalarSupplier

class ObservableJust<T>(private val value: T) : Observable<T>(), ScalarSupplier<T> {
    override fun subscribeActual(observer: Observer<T>) {
        val sd = ObservableScalarXMap.ScalarDisposable(observer, value)
        observer.onSubscribe(sd)
        sd.run()
    }

    override fun get() = value
}